package com.vipheyue.time;

import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;

public class MyService extends Service {
    private IBinder binder=new VoiceIBinder();
    private AudioManager _audioManager;
    private int _cachedVolume;
    private int _maxVolume;
    public static final int AUDIO_TYPE = AudioManager.STREAM_RING;
    //    public static final int AUDIO_TYPE = AudioManager.STREAM_SYSTEM;
    public MyService() {
        Log.i("MainActivity", "_maxVolume.........");
    }
    public void setaudioManager(AudioManager _audioManager) {
        this._audioManager=_audioManager;
            _maxVolume = _audioManager.getStreamMaxVolume(AUDIO_TYPE);
            _cachedVolume = _audioManager.getStreamVolume(AUDIO_TYPE);
            Log.i("MainActivity", "_maxVolume....." + _maxVolume);
            Log.i("MainActivity", "_cachedVolume....."+_cachedVolume);

    }
    @Override
    public IBinder onBind(Intent intent) {
        return binder;
    }

    public class VoiceIBinder extends Binder implements IVoice{
        @Override
        public String queryVoice(AudioManager _audioManager) {
            setaudioManager(_audioManager);
            return "setaudioManager(_audioManager)";
        }
    }
}
